document.addEventListener('DOMContentLoaded',function (){
    // 获取顶部右边菜单条操作，功能条显隐
    var nav = document.querySelector('.h_right').querySelector('.nav');
    var nav_lis = nav.children;
    for(var i=0; i<nav_lis.length; i++)
    {
        nav_lis[i].addEventListener('mouseover',   function () {
            this.children[1].style.display = 'block';
        });
        nav_lis[i].addEventListener('mouseout', function (){
            this.children[1].style.display = 'none';
        });
    }
    //学校管理功能模块设置
    var nav_finds = document.querySelectorAll('.nav_find');
    var nav1_lis = nav_finds[0].children;
    var main_nav = document.querySelector('.main_left_nav');
    var main_lis = main_nav.children;
    var ff=0;
    function closedivs() {
        for(var k=0; k<main_lis.length; k++)
        {
            main_lis[k].children[2].style.display = 'none';
            main_lis[k].children[3].style.display = 'none';
            main_lis[k].children[0].className = '';
        }
    }
    for (var j=0; j<nav1_lis.length; j++)
    {
        ff = j;
        if(ff===7||ff===8)
        {
            ff++;
        }
        nav1_lis[j].setAttribute('index', ff);
        nav1_lis[j].addEventListener('click', function (){
            closedivs();
            main_lis[this.getAttribute('index')].children[2].style.display = 'block';
            main_lis[this.getAttribute('index')].children[3].style.display = 'block';
            main_lis[this.getAttribute('index')].children[0].className = 'cuttent';
        });
    }
    //学籍管理功能模块设置
    var useraddmessages = document.querySelectorAll('.useraddmassage');
    var nav2_lis = nav_finds[1].children;
    console.log(nav2_lis);
    for (var j=0; j<nav2_lis.length; j++)
    {
        nav2_lis[j].setAttribute('index', j);
        nav2_lis[j].addEventListener('click', function (){
            closedivs();
            main_lis[7].children[2].style.display = 'block';
            main_lis[7].children[3].style.display = 'block';
            main_lis[7].children[0].className = 'cuttent';
            if(this.getAttribute('index')==='0')
            {
                useraddmessages[1].style.display = 'block';
            }
        });
    }
});
